using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace SmilingGoat.WindowsLiveWriter.Flickr
{
    public partial class TagList : Form
    {
        private string selectedTags = string.Empty;

        public string SelectedTags
        {
            get { return selectedTags; }
        }

        public TagList(FlickrNet.Tag[] tags)
        {
            InitializeComponent();

            for (int i = 0; i < tags.Length; i++)
            {
                listTags.Items.Add(tags[i].TagName);
            }
        }

        private void button1_Click(object sender, EventArgs e)
        {
            StringBuilder tags = new StringBuilder();

            foreach (object tag in listTags.CheckedItems)
            {
                if (tags.Length > 1)
                {
                    tags.Append(",");
                }
                tags.Append(tag.ToString());
            }

            selectedTags = tags.ToString();

            base.DialogResult = DialogResult.OK;
        }
    }
}